package org.liuyunfeng.service;

import org.liuyunfeng.domain.NewUser;
import org.liuyunfeng.domain.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author: TanJingyu
 * @create: 2022-03-02 18:24
 **/
@Service
public class UserService {
    @Autowired
    private UserMapper mapper;

    @Transactional
    public void deleteUser(Integer id) {
        mapper.delete(id);

        //

    }


//    @Transactional
    public void selectNewUser() throws InterruptedException {
        for (int i = 0; i < 10000; i++) {
            List<NewUser> newUsers = mapper.selectNewUser(20);
            System.out.println(newUsers);
            TimeUnit.SECONDS.sleep(2);
        }
    }
}

